package concurrencyPractice.chapter04;

import concurrencyPractice.GuardBy;

/**
 * @author xinya
 * @version 1.0
 * @project javacore
 * @description 程序4-3 通过私有锁来保护状态
 * @date 2023/12/28 14:46:05
 */
public class PrivateLock<Widget> {

    private final Object myLock = new Object();

    @GuardBy("myLock")
    Widget widget;

    void someMethod() {
        synchronized (myLock) {

        }
    }
}
